package com.valuegroup.smarttodo.data.enums;

import com.valuegroup.smarttodo.R;

public enum TaskSortTypeEnum {
    NORMAL(R.id.m0, R.string.task_sort_m0, 0),
    QUADRANT(R.id.m1, R.string.task_sort_m1, 1),
    DEADLINE(R.id.m2, R.string.task_sort_m2, 2),
    FINISH(R.id.m3, R.string.task_sort_m3, 3),
    ABC(R.id.m4, R.string.task_sort_m4, 4),
    CREATEDDT(R.id.m5, R.string.task_sort_m5, 5),
    UPDATEDT(R.id.m6, R.string.task_sort_m6, 6);

    private int menuId;
    private int sortType;
    private int textId;

    TaskSortTypeEnum(int menuId, int textId, int sortType) {
        this.menuId = menuId;
        this.textId = textId;
        this.sortType = sortType;
    }

    public static TaskSortTypeEnum getSortTypeForMenuId(int menuId) {
        for (TaskSortTypeEnum e : TaskSortTypeEnum.values()) {
            if (e.menuId == menuId) {
                return e;
            }
        }
        return TaskSortTypeEnum.NORMAL;
    }

    public static TaskSortTypeEnum getSortTypeEnum(int sortType) {
        for (TaskSortTypeEnum e : TaskSortTypeEnum.values()) {
            if (e.sortType == sortType) {
                return e;
            }
        }
        return TaskSortTypeEnum.NORMAL;
    }

    public static boolean isNormal(int sortType) {
        if (TaskSortTypeEnum.NORMAL.sortType == sortType) {
            return true;
        }
        return false;
    }

    public int getMenuId() {
        return menuId;
    }

    public int getSortType() {
        return sortType;
    }

    public int getTextId() {
        return textId;
    }
}
